package com.example.mz.dynamicdb.config;

import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ESClientConfig {

    @Bean
    public RestHighLevelClient restHighLevelClient() {
        RestHighLevelClient esClient = new RestHighLevelClient(
                // 9200端口为Elasticsearch的Web通信端口，localhost为启动ES服务的主机名,http为通信协议
                RestClient.builder(new HttpHost("124.223.22.117", 9200, "http")));
                return esClient;
    }
}
